/**
 * 初始化duallistbox
 * reqeustParams：查询参数
 * selectElement：select元素对应属性
 * optionValue
 * optionText
 * selectedDataStr：选中数据，值以,隔开
 */
function initListBox(url,reqeustParams,selectElement,optionValue,optionText, selectedDataStr) {

    $.ajax({
        url:url,
        type:"post",
        async:true,
        success:function(returnData){
            // var ss=$(selectElement)[0];
            // $(selectElement)[0].empty();

            // alert($(selectElement)[0].options);
            $(returnData).each(function () {
                var o = document.createElement("option")
                o.value = this[optionValue];
                o.text = this[optionText];
                if("undefined" != typeof (selectedDataStr) && selectedDataStr != ""){
                    var selectedDataArray = selectedDataStr.split(',');
                    $.each(selectedDataArray, function (i, val){
                        if(o.value = val){
                            o.selected = "selected";
                            return false;
                        }
                    });
                }

                $(selectElement)[0].options.add(o);
            });

            var selector = $(selectElement).bootstrapDualListbox(
                {
                    nonSelectedListLabel: '未选择',
                    selectedListLabel: '已选择',
                    preserveSelectionOnMove: 'moved',
                    moveOnSelect: false,           // 出现一个剪头，表示可以一次选择一个
                    filterTextClear: '展示所有',
                    moveSelectedLabel: "添加",
                    moveAllLabel: '添加所有',
                    removeSelectedLabel: "移除",
                    removeAllLabel: '移除所有',
                    infoText: '共{0}个',
                    showFilterInputs: false,       // 是否带搜索
                    selectorMinimalHeight: 360
                }
            );//重新加载刷新,
            // selector.bootstrapDualListbox('destroy', true);
            selector.bootstrapDualListbox('refresh', true);
        },
        error: function(e){
            alert(e.msg)
        }
    });
}